﻿<common:LayoutAwarePage
    x:Class="Fontographer.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Fontographer"
    xmlns:common="using:Fontographer.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <UserControl.Resources>
        <CollectionViewSource x:Key="fonts" Source="{Binding Fonts}" d:DataContext="{Binding Fonts[0], Source={d:DesignInstance Type=local:FontFinder, IsDesignTimeCreatable=False}}"  x:Name="fonts"/>
    </UserControl.Resources>
    <Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}" Click="backButton_Click"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Text="{StaticResource AppName}" Style="{StaticResource PageHeaderTextStyle}"/>
        </Grid>
        <ScrollViewer x:Name="fontViewer"
                      Grid.Row="1"
                      Margin="-10,-10,0,0"
                      >
            <ListView x:Name="itemsView"
                      Margin="120,0,0,60"
                      ItemsSource="{Binding Source={StaticResource fonts}}"
                      ItemTemplate="{StaticResource ImageTextCollectionTemplate}"/>
        </ScrollViewer>
    </Grid>
</common:LayoutAwarePage>
